<template>
    <div class="MoreGame" :class="tabClass">
        <!-- 左边 -->
        <div class="TableLeft">
            <transition enter-active-class="animated flipInX" leave-active-class="animated fadeOut">
                <!-- 开牌结果 -->
                <div class="opneCardRulet" v-show="winClass.str">
                    <div class="CardTitelTop">
                        <div ><span :class="{'divX':rm.GType==1,'divX2':rm.GType==2}">{{CardRule.x}}</span> </div>
                        <div class="CardTitelTopCenter">{{winClass.str}}</div>
                        <div ><span :class="{'divZ':rm.GType==1,'divZ2':rm.GType==2}">{{CardRule.z}}</span> </div>
                    </div>
                    <!-- 牌 -->
                    <div class="CardCenterBox" v-if="rm.BetMode==1">
                        <!-- 左边牌 -->
                        <div class="left">
                            <!-- <div class="CardBox" v-for="cardd in cards.card.right.cardCenter" :class="'card'+cardd"></div> -->
                            <img v-if="CardRule.xp[0]" :src="'./static/img/card/'+CardRule.xp[0]+'.png'" alt="" :class="{'cardDt':rm.GType==1}" >
                            <img v-if="CardRule.xp[1]" :src="'./static/img/card/'+CardRule.xp[1]+'.png'" alt="">
                            <img v-if="CardRule.xp[2]" :src="'./static/img/card/'+CardRule.xp[2]+'.png'" alt="">
                        </div>
                        <!-- 右边牌 -->
                        <div class="right">
                            <!-- <div class="CardBox" v-for="cardd in cards.card.right.cardCenter" :class="'card'+cardd"></div> -->
                            <img v-if="CardRule.zp[0]" :src="'./static/img/card/'+CardRule.zp[0]+'.png'" alt="">
                            <img v-if="CardRule.zp[1]" :src="'./static/img/card/'+CardRule.zp[1]+'.png'" alt="">
                            <img v-if="CardRule.zp[2]" :src="'./static/img/card/'+CardRule.zp[2]+'.png'"  alt=""  class='cardDt'>
                        </div>
                    </div>
                    <div class="TreeAndOne"  v-if="rm.BetMode==2">
                        <div class="isZ" v-show="rm.G_Result>=100&&Room.G_Result<200" >
                            {{cardResult.titel}}
                        </div>
                        <div class="isX" v-show="rm.G_Result>=200&&Room.G_Result<300">
                            {{cardResult.titel}}
                        </div>
                        <div class="isH" v-show="rm.G_Result>=300">
                            {{cardResult.titel}}
                        </div>
                    </div>								
                </div>
            </transition>
            <!-- 路单 -->
            <div class="vivwBox">
                <Luand ref="luandSon" :model.sync="ludan" @setLwz="setLwz"  @postMessage="postMessage" @setLwx="setLwx"></Luand>
            </div>
            <!-- 路单查询按钮 -->
            <div class="LudanInputBox">
                <!-- 局数 -->
                <div class="LudanResult">
                    <div class="num1" v-if="rm.GType==1"><span>{{Chips[0][1]}}</span> </div>
                    <div class="num2" v-if="rm.GType==1"><span>{{Chips[1][1]}}</span> </div>
                    <div class="num4" v-if="rm.GType==2"><span>{{Chips[0][1]}}</span> </div>
                    <div class="num5" v-if="rm.GType==2"><span>{{Chips[1][1]}}</span> </div>
                    <div class="num3"><span>{{Chips[2][1]}}</span> </div>

                </div>
                <!-- 限红 -->
                <div class="Abonus">
                    <span>限红：</span>{{rm.MoneyMin}}~{{rm.MoneyMax}} 
                </div>
                <!-- 庄问路，闲问路 -->
                <div class="askBox">
                    <div class="askInput xask">
                        <div class="isInput" @click="tabPostLudan(1)"><span v-if="rm.GType==1">闲问路</span><span v-if="rm.GType==2">虎问路</span> </div>
                        <!-- 标志 -->
                        <div class="signBox" v-html="lwxInput">

                        </div>
                    </div>
                    <div class="askInput zask">
                        <div class="isInput" @click="tabPostLudan(0)"><span v-if="rm.GType==1">庄问路</span><span v-if="rm.GType==2">龙问路</span> </div>
                        <!-- 标志 -->
                        <div class="signBox" v-html="lwzInput">

                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 右边 -->
        <div class="TableRight">
            <div class="center">
                <!-- 台桌 -->
                <div class="numBerCard">
                    <!-- 房间号 -->
                    <p>{{rm.GType==1?'B'+rm.TId:'L'+rm.TId}}</p>
                    <!-- 时间 -->
                    <div class="vivw" :style="{'color':NumberColor}">{{rm.RestHops}}</div>
                    <div class="textVivw">靴局:{{rm.CurrXue}}-{{rm.CurrJu}}</div>
                </div>
                <!-- 百家乐下注区 -->
                <div class="gameStart">
                    <!-- 百家乐下注区 -->
                    <div class="gameTopBox" v-show="rm.GType==1">
                            <div class="gameDown z" :class="{'Wining':winClass.z,'stopBet':!pz}" @click="Bets(0)">
                                <div :class="{'pz':pz}" class="winingPz"></div>
                                <!-- 当前筹码数 -->
                                <div class="moneyNum" v-show="from[0].downMoney||from[0].laodMoney"><span>{{from[0].laodMoney?(from[0].downMoney?from[0].downMoney:'')+ "+" +from[0].laodMoney:from[0].downMoney}}</span></div>
                                <div class="okcm" v-show="from[0].downMoney||from[0].laodMoney"></div>
                            </div>
                            <div class="gameDown h" :class="{'Wining':winClass.h,'stopBet':!pz}" @click="Bets(2)">
                                <div :class="{'pz':pz}" class="winingPz"></div>
                                <!-- 当前筹码数 -->
                                <div class="moneyNum" v-show="from[2].downMoney||from[2].laodMoney"><span>{{from[2].laodMoney?(from[2].downMoney?from[2].downMoney:'')+ "+" +from[2].laodMoney:from[2].downMoney}}</span></div>
                                <div class="okcm" v-show="from[2].downMoney||from[2].laodMoney"></div>
                            </div>
                            <div class="gameDown x" :class="{'Wining':winClass.x,'stopBet':!pz}" @click="Bets(1)">
                                <div :class="{'pz':pz}" class="winingPz"></div>
                                <!-- 当前筹码数 -->
                                <div class="moneyNum" v-show="from[1].downMoney||from[1].laodMoney"><span>{{from[1].laodMoney?(from[1].downMoney?from[1].downMoney:'')+ "+" +from[1].laodMoney:from[1].downMoney}}</span></div>
                                <div class="okcm" v-show="from[1].downMoney||from[1].laodMoney"></div>
                            </div>
                    </div>
                    <!-- 百家乐下注区 -->
                    <div class="gameCenterBox" v-show="rm.GType==1">
                        <div class="gameDown zh" :class="{'Wining':winClass.zh,'stopBet':!pz}" @click="Bets(3)">
                            <div :class="{'pz':pz}" class="winingPz"></div>
                            <!-- 当前筹码数 -->
                            <div class="moneyNum" v-show="from[3].downMoney||from[3].laodMoney"><span>{{from[3].laodMoney?(from[3].downMoney?from[3].downMoney:'')+ "+" +from[3].laodMoney:from[3].downMoney}}</span></div>
                            <div class="okcm" v-show="from[3].downMoney||from[3].laodMoney"></div>
                        </div>
                        <div class="gameDown xh" :class="{'Wining':winClass.xh,'stopBet':!pz}" @click="Bets(4)">
                            <div :class="{'pz':pz}" class="winingPz"></div>
                            <!-- 当前筹码数 -->
                            <div class="moneyNum" v-show="from[4].downMoney||from[4].laodMoney"><span>{{from[4].laodMoney?(from[4].downMoney?from[4].downMoney:'')+ "+" +from[4].laodMoney:from[4].downMoney}}</span></div>
                            <div class="okcm" v-show="from[4].downMoney||from[4].laodMoney"></div>
                        </div>
                    </div>
                    
                    <!-- 龙虎游戏下注区 -->
                    <div class="gameLonghuBox" v-show="rm.GType==2">
                        <!-- 龙 -->
                        <div class="long gameDown" :class="{'Wining':winClass.long,'stopBet':!pz}" @click="lhBets(0)">
                            <div :class="{'pz':pz}" class="winingPz"></div>
                            <!-- 下注时候筹码 -->
                            <div class="loadMoneyNum" v-show="lhfrom[0].laodMoney"><span>{{lhfrom[0].laodMoney}}</span></div>
                            <div class="loadDown" v-show="lhfrom[0].laodMoney"></div>
                            <!-- 当前筹码数 -->
                            <div class="moneyNum" v-show="lhfrom[0].downMoney"><span>{{lhfrom[0].downMoney}}</span></div>
                            <div class="okcm" v-show="lhfrom[0].downMoney"></div>
                        </div>
                        <!-- 和 -->
                        <div class="he gameDown" :class="{'Wining':winClass.lhh,'stopBet':!pz}" @click="lhBets(2)">
                            <div :class="{'pz':pz}" class="winingPz"></div>
                            <!-- 下注时候筹码 -->
                            <div class="loadMoneyNum" v-show="lhfrom[2].laodMoney"><span>{{lhfrom[2].laodMoney}}</span></div>
                            <div class="loadDown" v-show="lhfrom[2].laodMoney"></div>
                            <!-- 当前筹码数 -->
                            <div class="moneyNum" v-show="lhfrom[2].downMoney"><span>{{lhfrom[2].downMoney}}</span></div>
                            <div class="okcm" v-show="lhfrom[2].downMoney"></div>
                        </div>
                        <!-- 虎 -->
                        <div class="hu gameDown" :class="{'Wining':winClass.hu,'stopBet':!pz}" @click="lhBets(1)">
                            <div :class="{'pz':pz}" class="winingPz"></div>
                            <!-- 下注时候筹码 -->
                            <div class="loadMoneyNum" v-show="lhfrom[1].laodMoney"><span>{{lhfrom[1].laodMoney}}</span></div>
                            <div class="loadDown" v-show="lhfrom[1].laodMoney"></div>
                            <!-- 当前筹码数 -->
                            <div class="moneyNum" v-show="lhfrom[1].downMoney"><span>{{lhfrom[1].downMoney}}</span></div>
                            <div class="okcm" v-show="lhfrom[1].downMoney"></div>
                        </div>
                    </div>
                    <!-- 确定取消 -->
                    <div class="gameBootomBox">
                        <div class="Input postOk" :class="{'postOkPost':changeMoney}" @click="postBets">确定</div>
                        <div class="Input postBack" :class="{'postBackPost':changeMoney}" @click="backBets">取消</div>
                    </div>
                    <!-- 加注过程中的筹码 -->
                    <div class="postLoginMoney" :class="moneyAnit"></div>
                    <!-- 下注成功弹出窗 -->
                    <transition enter-active-class="animated2 bounceInUp" leave-active-class="animated2 fadeOut">
                        <div class="successBox" v-show="allLoadMoney">
                            下注成功{{allLoadMoney?allLoadMoney:''}}
                        </div>
                    </transition>
                    <!-- 未下注提示 -->
                    <transition enter-active-class="animated2 bounceInUp" leave-active-class="animated2 fadeOut">
                        <div class="nullDown" v-show="nullDown">
                            本局未下注
                        </div>
                    </transition>
                    <!-- 中奖弹出节目 -->
                    <transition leave-active-class="animated2 fadeOut">
                        <div class="winingBox" v-show="rm.WinLose>0">
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            <p>恭喜！中奖{{rm.WinLose}}</p>
                        </div>							
                    </transition>
                    <!-- 输了弹出 -->
                    <transition enter-active-class="animated2 fadeInUp" leave-active-class="animated2 fadeOut">
                        <div class="erreoBox" v-show="rm.WinLose<0">
                            输了{{rm.WinLose}}
                        </div>
                    </transition>
                </div>
            </div>
            <!-- 视频 -->
            <div class="canvas">
                <!-- h5 -->
                <!-- <canvas @mouseover="moveDiveo($event)" @mouseout="outDiveo($event)" v-starVideo ></canvas> -->
                <!-- falsh -->
                    
                <div class="pz">
                    <object type="application/x-shockwave-flash" class="Falsh" @mouseover="moveDiveo($event)" @mouseout="outDiveo($event)" data="./static/falsh/LivePlayer2.swf" v-starFalsh="{set:setFalsh}">
                        <param name="menu" value="false">
                        <param name="scale" value="exactFit">
                        <param name="allowFullscreen" value="true">
                        <param name="allowScriptAccess" value="always">
                        <param name="bgcolor" value="#000000">
                        <param name="wmode" value="direct">
                    </object>
                    <div class="loginDV" v-show="videoStatus" ></div>
                    <span v-show="videoStatus" >加载中...</span>						
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import Luand from "@/components/Ludan.vue"

export default {
    name:"More",
    components:{
		Luand,
	},
	props:["M","keyid"],
	data(){
		return {
			from:[
				{downMoney:0,laodMoney:0},
				{downMoney:0,laodMoney:0},
				{downMoney:0,laodMoney:0},
				{downMoney:0,laodMoney:0},
				{downMoney:0,laodMoney:0}
			],
			lhfrom:[
				{downMoney:0,laodMoney:0},
				{downMoney:0,laodMoney:0},
				{downMoney:0,laodMoney:0},
			],
			// 控制下注动画
			moneyAnit:"",
			// 总下注额
			allLoadMoney:0,
			// 未下注开启控制数据
			nullDown:false,
			// 切桌子动画Class
			tabClass:"",
			// 记时器
			setIntvalObj:null,
			lwxInput:null,
			lwzInput:null,
			falsh:null,
			jsInit:false,
			falshSetTime:null,
		}	
	},
	computed:{
		// 获取本台桌数据
		rm(){
			return this.$store.getters.ManyGame[this.keyid];
		},
		videoStatus(){
			return this.$store.getters.videoStatus[this.keyid+2]
		},
		// 路单
		ludan(){
			let a={models:this.rm.GType ,data:this.rm.LuDan }
			return a;
		},
		// 庄闲和人数
		Chips(){
			let a=this.rm.ChipsSum;
			let b=a.split(",");
			for(let i=0;i<b.length;i++){
				b[i]=b[i].split("/");
			}
			return b;
		},
		// 下注了开启确定取消按钮
		changeMoney(){
			var a=false;
			this.from.forEach(element => {
				if(element.laodMoney>0){
					a=true;
				}
			});
			this.lhfrom.forEach(array=>{
				if(array.laodMoney>0){
					a=true;
				}
			})
			if(this.rm.RestHops<6){
				a=false;
			}				
			return a;
		},
		// 时间字体颜色
		NumberColor(){
			if(this.rm.RestHops<10){
				return 'red';
			}else{
				return '#fff'
			}
		},
		// 停止下注
		pz(){
			if(this.rm.RestHops<=0){
				return false;
			}
			else if(this.rm.RestHops==5){
				window.AudioObj.Play(["stopbet"])
				let a=0;//判断是否未下注
				switch(this.rm.GType){
					case 1:
						this.from.forEach(array=>{
							a+=array.downMoney;
						})
					break;
					case 2:
						this.lhfrom.forEach(array=>{
							a+=array.downMoney;
						})
					break;
				}
				if(a==0){
					this.nullDown=true;
					setTimeout(()=>{
						this.nullDown=false;
					},2000)
				}
				return false;//关闭下注
			}
			else if(this.rm.RestHops<6){//关闭下注
				return false;
			}
			else{//开启下注
				return true;
			}
		},
		PublicBet(){
			return this.$store.getters.publicWarehouse.ManyGame[this.keyid];
		},
		winClass(){
			let a={
				z:false,
				h:false,
				x:false,
				zh:false,
				xh:false,
				long:false,
				lhh:false,
				hu:false,
				str:""
			}
			let b=this.rm.G_Result;
			// 获取开奖结果
			if(this.rm.GType==1){
				switch(b){
					case "300":
						a.str = "和局";
						a.h=true;
						break;
					case "310":
						a.str = "和局庄对";
						a.h=true;
						a.zh=true;
						break;
					case "311":
						a.str = "和局庄闲对";
						a.h=true;
						a.xh=true;
						a.zh=true;
						break;
					case "301":
						a.str = "和局闲对";
						a.h=true;
						a.xh=true;
						break;
					case "100":
						a.str = "庄赢";
						a.z=true;
						break;
					case "110":
						a.str = "庄赢庄对";
						a.z=true;
						a.zh=true;
						break;
					case "111":
						a.str = "庄赢庄闲对";
						a.z=true;
						a.zh=true;
						a.xh=true;
						break;
					case "101":
						a.str = "庄赢闲对";
						a.z=true;
						a.xh=true;
						break;
					case "200":
						a.str = "闲赢";
						a.x=true;
						break;
					case "210":
						a.str = "闲赢庄对";
						a.x=true;
						a.zh=true;
						break;
					case "211":
						a.str = "闲赢庄闲对";
						a.x=true;
						a.zh=true;
						a.xh=true;
						break;
					case "201":
						a.str = "闲赢闲对";
						a.x=true;
						a.xh=true;
						break;
				}				
			}
			else if(this.rm.GType==2){
				switch(b){
					case "300":
						a.str = "和局";
						a.lhh=true;
                    break;
					case "310":
						a.str = "和局";
						a.lhh=true;
						break;
					case "311":
						a.str = "和局";
						a.lhh=true;
						break;
					case "301":
						a.str = "和局";
						a.lhh=true;
						break;
					case "100":
						a.str = "龙赢";
						a.long=true;
						break;
					case "110":
						a.str = "龙赢";
						a.long=true;
						break;
					case "111":
						a.str = "龙赢";
						a.long=true;
						break;
					case "101":
						a.str = "龙赢";
						a.long=true;
						break;
					case "200":
						a.str = "虎赢";
						a.hu=true;
						break;
					case "210":
						a.str = "虎赢";
						a.hu=true;
						break;
					case "211":
						a.str = "虎赢";
						a.hu=true;
						break;
					case "201":
						a.str = "虎赢";
						a.hu=true;
						break;
				}
			}
			return a;
		},
		//开奖牌面结果
		CardRule(){
			let data=this.rm.PaiMian;
			let a={x:0,z:0,xp:[],zp:[]};
			let b=[];
			if(data){
				let c=data.split(",");
				c.forEach(array=>{
					if(array<20000){
						array=array%10000;
						a.zp.push(array);
					}else{
						array=array%10000;
						a.xp.push(array);
					}
					array=(array%1000)/10;
					array=array>10?10:array;
					b.push(array);
				})

				if(this.rm.GType==1){
					a.z=(b[0]+b[1]+b[2])>10?(b[0]+b[1]+b[2])%10:(b[0]+b[1]+b[2]);
					a.x=(b[3]+b[4]+b[5])>10?(b[3]+b[4]+b[5])%10:(b[3]+b[4]+b[5]);					
				}
				else if(this.rm.GType==2){
					a.z=b[0];
					a.x=b[1];
				}

				// 播放音频
				if(this.rm.GType==1){
					window.AudioObj.Play(["z"+a.z,"x"+a.x,"bjl"+this.rm.G_Result])
				}
				else if(this.rm.GType==2){
					window.AudioObj.Play(["l"+a.z,"h"+a.x,"lh"+this.rm.G_Result])
				}	
			}
			return a;
		},
	},
	watch:{
		// 监控房间时间
		"rm.RestHops":function(Val,oldVal){
			if(Val!==oldVal){
				if(Val==0){
					clearInterval(this.setIntvalObj);
					this.$store.commit("BetTimeOut")
				}				
			}
		},
		"rm.CurrState":function(val,oldVal){
			if(val!=oldVal){
				switch(val){
					case 2://开局
						this.starSetIntval();
						if(this.rm.GType==1){
							this.from=[
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0}
							]
						}
						else if(this.rm.GType==2){
							this.lhfrom=[
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
							]
						}

						if(this.rm.RestHops!=0&&this.rm.RestHops>5){
							window.AudioObj.Play(["startbet"])							
						}
					break;
					case 7://作废
						if(this.rm.GType==1){
							this.from=[
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0}
							]
						}
						else if(this.rm.GType==2){
							this.lhfrom=[
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
								{downMoney:0,laodMoney:0},
							]
						}
						this.$store.commit("changeTips",{data:this.rm.TId+"号桌本局作废"});
					break;
				}
			}
		},
		"PublicBet":function(Val){
					if(Val.RoomBetInfo){
						let a= Val.RoomBetInfo;
						let b={
							BetInfo:[],
							BetHistory:[]
						}
						b.BetInfo=a.BetInfo.split(",");
						b.BetHistory=a.BetHistory.split(",")
						switch(this.rm.GType){
							case 1:
								b.BetInfo.forEach(array=>{
									this.allLoadMoney+=parseInt(array);
								})

								for(let i=0;i<5;i++){
									this.from[i].laodMoney=0;
									this.from[i].downMoney=parseInt(b.BetHistory[i]);
								}
							break;
							case 2:
								b.BetInfo.forEach(array=>{
									this.allLoadMoney+=parseInt(array);
								})
								for(let i1=0;i1<3;i1++){
									this.lhfrom[i1].laodMoney=0;
									this.lhfrom[i1].downMoney=parseInt(b.BetHistory[i1]);
								}
							break;					
						}
						setTimeout(()=>{
							this.allLoadMoney=0;
						},2000);
						this.$store.commit("ClearPublicWarehouse",{index:3,data:this.keyid});
					}
					else if(Val.RoomLoserBet){
						switch(this.rm.GType){
							case 1:
								for(let i=0;i<5;i++){
									this.from[i].laodMoney=0;
								}
							break;
							case 2:
								for(let i=0;i<3;i++){
									this.lhfrom[i].laodMoney=0;
								}
							break;					
						}
						this.$store.commit("ClearPublicWarehouse",{index:3,data:this.keyid});
					}
		},
		"rm.BetHistory":function(val,old){
			if(val!=old){
				let b=val.split(",");
				switch(this.rm.GType){
					case 1:
						for(let i=0;i<5;i++){
							this.from[i].downMoney!=parseInt(b[i])?this.from[i].downMoney=parseInt(b[i]):false;
						}
					break;
					case 2:
						for(let i1=0;i1<3;i1++){
							this.lhfrom[i1].downMoney!=parseInt(b[i1])?this.lhfrom[i1].downMoney=parseInt(b[i1]):false;
						}
					break;					
				}
			}
		},
		// 监控视频地址是否发生变化
		"rm.VideoUrl":function(val,old){
			if(val!=old){
				if(this.jsInit){
					let index=this.keyid+2;
					let data=true;
					this.$store.commit("setVideoStatus",{index,data})
					this.starPlay();
				}
			}
		},
		'rm.TId':function(val,old){
			if(val!=old){
				this.tabClass='TabAnimate';
				setTimeout(()=>{
					this.tabClass='';
				},1000)
			}
		}
	},
	methods:{
		// 百家乐下注
		Bets(el){
			if(this.rm.RestHops<6){
				this.$store.commit("changeTips",{data:"超过下注时间，请等候下局", Out:false})
				return false;
			}
			switch(el){
				case 0:
				this.moneyAnit="tranMoney1"
				break;
				case 1:
				this.moneyAnit="tranMoney3"
				break;
				case 2:
				this.moneyAnit="tranMoney2"
				break;
				case 3:
				this.moneyAnit="tranMoney4"
				break;
				case 4:
				this.moneyAnit="tranMoney5"
				break;
			}
			this.from[el].laodMoney+=parseInt(this.M);
			this.$store.commit("reduceMoney",parseInt(this.M)*-1);//预减少余额
		},
		// 龙虎下注
		lhBets(el){
			if(this.rm.RestHops<6){
				this.$store.commit("changeTips",{data:"超过下注时间，请等候下局", Out:false})
			}
			switch(el){
				case 0:
				this.moneyAnit="tranMoney6"
				break;
				case 1:
				this.moneyAnit="tranMoney8"
				break;
				case 2:
				this.moneyAnit="tranMoney7"
				break;
			}
			this.lhfrom[el].laodMoney+=parseInt(this.M);
			this.$store.commit("reduceMoney",parseInt(this.M)*-1);//预减少余额
		},
		// 取消下注
		backBets(){
			if(!this.changeMoney){
				return false;
			}
			let a=0;
			if(this.rm.GType==1){
				this.from.forEach(array=>{
					a+=array.laodMoney;
					array.laodMoney=0;
				})				
			}
			else if(this.rm.GType==2){
				this.lhfrom.forEach(array=>{
					a+=array.laodMoney;
					array.laodMoney=0;
				})				
			}
			this.$store.commit("reduceMoney",a);
		},
		// 确定下注
		postBets(){
			if(!this.changeMoney){
				return false;
			}
			// 判断当前游戏类型
			let BetInfo="";
			let nowDate=Math.round(new Date().getTime()/1000)
			switch(this.rm.GType){
				case 1://百家乐
					BetInfo=this.from[0].laodMoney+","+this.from[1].laodMoney+","+this.from[2].laodMoney+","+this.from[3].laodMoney+","+this.from[4].laodMoney;
					window.userSocket.uSend('{"ActType":2,"ErrorCode":10000,"Content":{"BetInfo":"'+BetInfo+'","UId":"' + UserId + '","IsAllIn":false,"CurrJu":'+this.rm.CurrJu+',"CurrXue":'+this.rm.CurrXue+',"TimeStamp":'+nowDate+'},"UId":"' + UserId + '","ConnectionId":"","GTableId":'+this.rm.TId+',"GT":'+this.rm.GType+',"RandCode":"' + RandCode + '"}');
				break;
				case 2://龙虎
					BetInfo=this.lhfrom[0].laodMoney+","+this.lhfrom[1].laodMoney+","+this.lhfrom[2].laodMoney;
					window.userSocket.uSend('{"ActType":2,"ErrorCode":10000,"Content":{"BetInfo":"'+BetInfo+'","UId":"' + UserId + '","IsAllIn":false,"CurrJu":'+this.rm.CurrJu+',"CurrXue":'+this.rm.CurrXue+',"TimeStamp":'+nowDate+'},"UId":"' + UserId + '","ConnectionId":"","GTableId":'+this.rm.TId+',"GT":'+this.rm.GType+',"RandCode":"' + RandCode + '"}');
				break;
			}
			window.AudioObj.Play(['down'])
		},
		// 路问路单
		tabPostLudan(x){
			this.$refs.luandSon.tabLudan(x);
		},
		// 移入视频放大效果
		moveDiveo(event){
			if(this.keyid!=3){
				event.target.parentNode.style="height:202.5%;width:219%;top:0px;z-index:500;"
			}else{
				event.target.parentNode.style="height:202.5%;width:240%;bottom:0px;z-index:500;"
			}
		},
		outDiveo(event){
			event.target.parentNode.style="";
		},
		// 启动定时器
		starSetIntval(){
			clearInterval(this.setIntvalObj);
			this.setIntvalObj=setInterval(()=>{
				this.$store.commit("setManyTime",this.keyid);
			},1000)
		},
		// 设置路问庄，路问闲按钮
		setLwz(html){
			this.lwzInput!=html?this.lwzInput=html:false;
		},
		setLwx(html){
			this.lwxInput!=html?this.lwxInput=html:false;
		},
		// 生产路单
		postMessage(msg){
			let a=msg;
			a.room=this.keyid;
			this.$emit('postMessage',a)
		},
		// 保存falsh对象
		setFalsh(dom){
			this.falsh=dom;
			this.falshPaly();
		},
		// 初始化
		falshPaly(){
			setTimeout(()=>{
				let el=this.falsh;
					if(el.jsInit){
						this.jsInit=true;
						let a=this.rm.VideoUrl;
						let el=this.falsh;
						let index=this.keyid;
						el.jsInit(null,"liveInit","b"+index);
						if(a!=''){
							this.starPlay();
						}			
					}else{
						this.falshPaly();
					}
			},800)
		},
		// 开始播放视频
		starPlay(){
			let a=this.rm.VideoUrl;
			let el=this.falsh;
			let index=parseInt(this.keyid);
			window.videoSet[index+2]?clearInterval(window.videoSet[index+2]):false;
			a=a.split("**")
			a.forEach((array,k)=>{
				a[k]=array.split("^^")
			})
			el.playLive(a[0][0],a[0][1]);
			window.videoSet[index+2]=setInterval(()=>{
				el.playLive(a[0][0],a[0][1]);
			},10000)
		}
	},
	// 自定义指令
	directives:{
		// H5视频启动指令
		// starVideo:{
		// 	bind(el){
		// 		new AMT.Player('ws://125.90.93.106:8084/', { canvas: el, autoplay: true, vlab: "v2" },false);
		// 	}
		// },
		// FALSH启动指令
		starFalsh:{
			bind(el,val){
				let set=val.value.set;
				set(el);
			},
		}
	},
	// 销毁资源
	beforeDestroy(){
		clearInterval(window.videoSet[this.keyid+2]);
		clearInterval(this.setIntvalObj)//清除定时器
		this.$store.commit("initManyGame");//初始化数据
		for(let i=2;i<7;i++){
			this.$store.commit("setVideoStatus",{index:i,data:true});
		}
	}
}
</script>
